import axios from 'axios';
import ConfigurationInstance from './configurationService';



const {address, password, username} = ConfigurationInstance.configuration;

const axiosService = axios.create({
    baseURL: `${address}`,
    withCredentials: true
});

ConfigurationInstance.on('update', (e) => {
    const {address} = ConfigurationInstance.configuration;
    axiosService.defaults.baseURL = `${address}`;
    ConfigurationInstance.emit('reload');
});

export default axiosService;